<?php
/*
Copyright (C) 2009 de Flotte Maxence

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
?>
<?php
//Box
class std_Box extends Bout {
	var $width;
	var $height;
	var $flux;
	var $style;

	function setWidth($width) {
		$this->width = $width;
	}

	function setHeight($height) {
		$this->height = $height;
	}

	function setStyle($Style) {
		$this->style .= $Style.';';
	}

	function readFlux() {
		$return = null;
		if(isset($this->_Flux))
			foreach($this->_Flux as $flux)
				if($flux['type'] == 'text')
					$return .= '<pre>'.htmlentities(file_get_contents($flux['flux'])).'</pre>';
				elseif($flux['type'] == 'html')
					$return .= file_get_contents($flux['flux']);
		return $return;
	}

	function build() {
		$Style = null;
		if(isset($this->width))
			$Style = 'width:'.$this->width.'; ';
		if(isset($this->height))
			$Style .= ' height:'.$this->height.'; ';
		if(isset($this->style))
			$Style .= $this->style;
		return '	<div id="'.$this->name.'" style="'.$Style.' float:left;">'."\n".$this->readFlux()."\n".$this->inner.'	</div>'."\n";
	}
}
?>